<?php
/*
 * Niken Larasati
 * larasati.n@students.amikom.ac.id
 */

class cetak_laporan_penduduk extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library('tanggal');
        $this->load->library('pdf');
    }

    function cetak_penduduk_nik() {
        $this->load->model('umum_m');
        $this->load->model('penduduk_m');
        $data_penduduk = $this->penduduk_m->detail_cari(array('nik' => $this->uri->segment(3)))->row();
        $tanggal = date ("d-m-Y");
        $this->pdf->SetCreator(PDF_CREATOR);
        $this->pdf->SetAuthor('SI Gunungsari');
        $this->pdf->SetTitle('Laporan Penduduk');
        $this->pdf->SetSubject('Laporan Penduduk');
        $this->pdf->SetKeywords('Laporan Penduduk');
        $this->pdf->setPrintHeader(false);
        $this->pdf->setPrintFooter(false);
        // set default header data
        $this->pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
        // set default monospaced font
        $this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

        $this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER);

        //set auto page breaks
        $this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

        //set image scale factor
        $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

        //set some language-dependent strings
        //       $this->pdf->setLanguageArray($l);
        // ---------------------------------------------------------
        // set font
        $this->pdf->SetFont('times', '', 9);

        // add a page
        $this->pdf->AddPage('P', 'A4');
        ob_start();
        ?>
        
        <div>
            <table width="100%" border="0" align="right">
                <tr>
                    <td><div>
                            <table width="100" border="1" align="right">
                                <tr>
                                    <td><div align="center"><b>F-1.21</b></div></td>
                                </tr>
                            </table>
                        </div></td>
                </tr>
            </table>
            <div align="center"><strong>FORMULIR PERMOHONAN KARTU TANDA PENDUDUK (KTP) WARGA NEGARA INDONESIA</strong> </div>
            <!--Perhatian-->
            <table width="100%" border="1" class="style2">
                <tr>
                    <td><p><b> Perhatian :</b><br>
                            1. Harap diisi dengan huruf cetak dan menggunakan tinta hitam <br>
                            2. Untuk kolom pilihan, harap memberi tanda silang (X) pada pilihan<br>
                            3. Setelah formulir ini diisi dan ditandatangani, harap diserahkan kembali ke kantor Desa/Kelurahan
                        </p>                    
                    </td>
                </tr>
            </table>          
            <table width="100%" border="0">
                <tr>
                    <td>
                        <!--Isi form 1-->
                        <table width="100%" border="0" class="style1">
                            <tr>
                            <br>
                            <td width="37%">PEMERINTAH PROVINSI    </td>
                            <td width="1%">:</td>
                            <td width="10%">35</td>
                            <td width="77%">JAWA TIMUR</td>
                </tr>
                <tr>
                    <td>PEMERINTAH KABUPATEN/KOTA</td>
                    <td>:</td>
                    <td>01</td>
                    <td>PACITAN</td>
                </tr>
                <tr>
                    <td>KECAMATAN</td>
                    <td>:</td>
                    <td>006</td>
                    <td>ARJOSARI</td>
                </tr>
                <tr>
                    <td>KELURAHAN</td>
                    <td>:</td>
                    <td>2005</td>
                    <td>GUNUNGSARI</td>
                </tr>
            </table>
            <!--Isi form 2-->
            <table width="100%" border="0">
                <tr>
                    <td><b><u><i>PERMOHONAN KTP</i></u></b></td>
                    <td width="12%"> A. Baru</td>
                    <td width="20%"> B. Perpanjangan</td>
                    <td width="20%"> C. Penggantian</td>
                </tr>
            </table>

            <!--Isi form 3-->
            <br>
            <table width="100%" border="0" class="style2">
                <tr>
                    <td width="30%">1. Nama Lengkap</td>
                    <td width="1%"></td>
                    <td width="69%"><?php echo $data_penduduk->nama; ?></td>
                </tr>
                <tr>
                    <td>2. Tempat Tanggal Lahir</td>
                    <td></td>
                    <td><?php echo $data_penduduk->tempat_lahir; ?></td>
                </tr>
                <tr>
                    <td>3. No. Kartu Keluarga</td>
                    <td></td>
                    <td><?php echo $data_penduduk->no_kk; ?></td>
                </tr>
                <tr>
                    <td>4. NIK</td>
                    <td></td>
                    <td><?php echo $data_penduduk->nik; ?></td>
                </tr>
                <tr>
                    <td>5. Status Perkawinan</td>
                    <td></td>
                    <td><?php echo $data_penduduk->status_kawin; ?></td>
                </tr>
                <tr>
                    <td>6. Agama</td>
                    <td></td>
                    <td><?php echo $data_penduduk->agama;  ?></td>
                </tr>
                <tr>
                    <td>7. Pekerjaan</td>
                    <td></td>
                    <td><?php echo $data_penduduk->pekerjaan;  ?></td>
                </tr>
                <tr>
                    <td>8. Alamat</td>
                    <td></td>
                    <td><?php echo $data_penduduk->alamat . ' RT ' . $data_penduduk->rt . ' RW ' . $data_penduduk->rw;  ?></td>
                </tr>                
                <tr>
                    <td></td>
                    <td></td>
                    <td>Ds. <?php echo $data_penduduk->desa;  ?>    Kec. <?php echo $data_penduduk->kecamatan;  ?></td>
                </tr>
            </table>
            <br>
            <!--Isi form 4-->
            <table width="100%" border="0">
                <tr>
                    <td width="50%">
                        <table width="100%" border="1">
                            <tr align="center">
                                <td width="35%">Pas Poto (2x3)</td>
                                <td width="35%">Cap Jempol</td>
                                <td width="60%">Specimen Tanda Tangan</td>
                            </tr>
                            <tr>
                                <td rowspan="2"></td>
                                <td rowspan="2">&nbsp;</td>
                                <td height="60">&nbsp;</td>
                            </tr>
                            <tr>
                                <td>Ket. Cap jempol/Tanda Tangan</td>
                            </tr>
                        </table>    
                    </td>
                    <td width="70%">
                        <table width="100%" border="0" align="center">
                            <tr align="center">
                                <td>Pacitan, <?php echo $tanggal; ?>
                                    <br>
                                    Pemohon,
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    ( <?php echo $data_penduduk->nama; ?> )
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <br>
            <table width="100%" border="0">
                <tr>
                    <td>
                        <table width="100%" border="0" align="center">
                            <tr>
                                <td colspan="2" align="center">Mengetahui</td>
                            </tr>
                            <tr>
                                <td width="50%" align="center">Camat <?php echo $data_penduduk->kecamatan; ?>
                                    <br>
                                    <br>
                                    <br>
                                    ( AMAT TAUFAN, S.Sos )
                                </td>
                                <td width="50%" align="center">Kepala Desa/Lurah <?php echo $data_penduduk->desa; ?>
                                    <br>
                                    <br>
                                    <br>
                                    ( BAKRI )
                                </td>
                            </tr>
                        </table>

                    </td>
                </tr>
            </table>




            <!--Akhir main-table-->
        </td>
        </tr>
            </table></div>


        <?php
        $konten_2 = ob_get_contents();
        ob_end_clean();


        $this->pdf->writeHTML($konten_2, true, false, true, false, '');
        $this->pdf->Output('Laporan Penduduk.pdf', 'I');
    }
    
    

}
?>
